﻿@model Article
@{
    MeunBLL bll = new MeunBLL();
    TemplateBLL TempBll = new TemplateBLL();
}
<div class="widget-content">
    <div class="widget-box">
        <div class="widget-title">
            <span class="icon"><i class="icon-align-justify"></i></span>
            <h5>
                填写文章信息</h5>
        </div>
        <div class="widget-content nopadding">
            @if (IsPost == true)
            {
                if (ViewBag.Result)
                {
                <div class="alert alert-success" style="margin-bottom: 0px;">
                    <a class="close" data-dismiss="alert" href="#">×</a>
                    <h4 class="alert-heading">
                        保存成功!</h4>
                    您的文章已经成功保存,你可以继续添加或者返回列表查看文章信息.
                </div>
                }
                else
                {
                <div class="alert alert-error" style="margin-bottom: 0px;">
                    <a class="close" data-dismiss="alert" href="#">×</a>
                    <h4 class="alert-heading">
                        保存失败!</h4>
                    如确认您的数据填写无误,请联系管理员或查看错误日志.
                </div>
                }
            }
            <form action="@Url.Action("Info", "Article", new { id = Request.QueryString["id"] })" method="post" class="form-horizontal" enctype="multipart/form-data" >
            <div class="widget-title">
                <ul class="nav nav-tabs">
                    <li class="active"><a data-toggle="tab" href="#tab1">基本信息</a></li>
                    <li><a data-toggle="tab" href="#tab2">内容设置</a></li>
                </ul>
            </div>
            <div class="widget-content tab-content">
                <div id="tab1" class="tab-pane active">
                    <div class="control-group">
                        <label class="control-label">
                            标题:</label>
                        <div class="controls">
                            @Html.TextBoxFor(i => i.Title, new { @class = "span6", q = "q", maxL = 200 })
                            <span class="help-block">请输入文章显示的标题 [最多输入200字符]  模版占位符：$model.Title (循环中:$item.Title)</span>
                        </div>
                    </div>
                    <div class="control-group" style="display:none">
                        <label class="control-label">
                            英文标题:</label>
                        <div class="controls">
                            @Html.TextBoxFor(i => i.TitleEN, new { @class = "span6", q = "q", maxL = 200 })
                            <span class="help-block">请输入文章显示的标题 [最多输入200字符]  模版占位符：$model.TitleEN (循环中:$item.TitleEN)</span>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            所属栏目:</label>
                        <div class="controls">
                            <div class="span6">
                                @Html.DropDownListFor(i => i.MeunId, bll.GetListItem())
                                <span class="help-block">请选择文章所属的栏目   模版占位符：$model.MeunId (循环中:$item.MeunId)</span>
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            内容模板:</label>
                        <div class="controls">
                            <div class="span6">
                                @{
                                    List<SelectListItem> List_C = TempBll.Select().Select(i => new SelectListItem() { Text = i.Name, Value = i.Name }).ToList();
                                    List_C.Insert(0, new SelectListItem() { Text = "栏目默认模板", Value = "" });
                                }
                                @Html.DropDownListFor(i => i.ContentTemp, List_C) <span class="help-block">请选择文章所使用的模板
                                    [若不选择则默认使用所属栏目的内容模板]  </span>
                            </div>
                        </div>
                    </div>
                    <div class="control-group" style="display:none">
                        <label class="control-label">
                            英文版模板:</label>
                        <div class="controls">
                            <div class="span6">
                                @{
                                    List<SelectListItem> List_M = TempBll.Select().Select(i => new SelectListItem() { Text = i.Name, Value = i.Name }).ToList();
                                    List_M.Insert(0, new SelectListItem() { Text = "栏目默认模板", Value = "" });
                                }
                                @Html.DropDownListFor(i => i.MobileTemp, List_M)
                                <span class="help-block">请选择文章所使用的英文版模板 [若不选择则默认使用所属栏目的英文版内容模板]</span>
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            关键字:</label>
                        <div class="controls">
                            @Html.TextBoxFor(i => i.keys, new { @class = "span6", maxL = 200 })
                            <span class="help-block">请输入关键字，多个关键字请用","隔开 [最多200个字符]   模版占位符：$model.keys (循环中:$item.keys)</span>
                        </div>
                    </div>
                    <div class="control-group" style="display:none">
                        <label class="control-label">
                            英文关键字:</label>
                        <div class="controls">
                            @Html.TextBoxFor(i => i.keysEN, new { @class = "span6", maxL = 200 })
                            <span class="help-block">请输入关键字，多个关键字请用","隔开 [最多200个字符]  模版占位符：$model.keysEN (循环中:$item.keysEN)</span>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            摘要:</label>
                        <div class="controls">
                            @Html.TextAreaFor(i => i.Abstract, new { @class = "span6", rows = "3", maxL = 2000 })
                            <span class="help-block">请输入文章摘要 [最多输入2000个字符]  模版占位符：$model.Abstract (循环中:$item.Abstract)</span>
                        </div>
                    </div>
                     <div class="control-group" style="display:none">
                        <label class="control-label">
                            英文摘要:</label>
                        <div class="controls">
                            @Html.TextAreaFor(i => i.AbstractEN, new { @class = "span6", rows = "3", maxL = 2000 })
                            <span class="help-block">请输入文章摘要 [最多输入2000个字符]  模版占位符：$model.AbstractEN (循环中:$item.AbstractEN)</span>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            缩略图:</label>
                        <div class="controls">
                            <input name="Thumbnail" type="file" class="span6" />
                            @if (Model.Thumbnail != null)
                            {
                                <img src="@Url.Content(Model.Thumbnail.Replace("img/", "~/Upload/"))" width="60" height="60" alt="缩略图" />
                                <input name="Thumbnail" value="@Model.Thumbnail" type="hidden" />
                            }
                            <span class="help-block">请上传文章的缩略图  模版占位符：$model.Thumbnail (循环中:$item.Thumbnail)</span>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            推荐位置</label>
                        <div class="controls">
                            @foreach (SelectListItem item in new SelectListItem[] 
                    { 
                        new SelectListItem{Text="英文站点显示",Value="1"}                          
                    })
                            {
                                <label>
                                    <input type="checkbox" name="Recommend" value="@item.Value" 
                            @if (Model != null && (Model.ID == 0 && item.Value == "1") || (!string.IsNullOrWhiteSpace(Model.Recommend) && Model.Recommend.Contains(string.Format(",{0},", item.Value))))
                            {
                                @Html.Raw("checked=\"checked\"")
                            }
                            />
                                    @item.Text</label>
                            }
                        </div>
                    </div>
                    @*                    <div class="control-group">
                        <label class="control-label">
                            跳转链接:</label>
                        <div class="controls">
                            @Html.TextBoxFor(i => i.Links, new { @class = "span6", url = "true" })
                            <span class="help-block">请输入文章需要跳转的URL地址，不填则使用默认地址</span>
                        </div>
                    </div>*@
                    <div class="control-group">
                        <label class="control-label">
                            页面名称:</label>
                        <div class="controls">
                            @Html.TextBoxFor(i => i.PageName, new { @class = "span6" })
                            <span class="help-block">请输入文章生成Html页面的名称  模版占位符：$model.PageName (循环中:$item.PageName)</span>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            排列顺序:</label>
                        <div class="controls">
                            @Html.TextBoxFor(i => i.Sort, new { @class = "span6", q = "q", @int = "int" })
                            <span class="help-block">请输入文章排列的顺序,数值越大位置越高(默认为0) [只能输入整数]</span>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            招聘人数 :</label>
                        <div class="controls">
                            @Html.TextBoxFor(i => i.Entity, new { @class = "span6" })
                            <span class="help-block">请输入招聘文章 Entity  模版占位符：$model.Entity (循环中:$item.Entity)</span>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            职位职能 :</label>
                        <div class="controls">
                            @Html.TextBoxFor(i => i.Functions, new { @class = "span6" })
                            <span class="help-block">请输入招聘文章 Function  模版占位符：$model.Function (循环中:$item.Function)</span>  
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            工作地点 :</label>
                        <div class="controls">
                            @Html.TextBoxFor(i => i.Location, new { @class = "span6" })
                            <span class="help-block">请输入招聘文章 Location  模版占位符：$model.Location (循环中:$item.Location)</span>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            空 :</label>
                        <div class="controls">
                            @Html.TextBoxFor(i => i.Department, new { @class = "span6" })
                            <span class="help-block">请输入招聘文章 Department  模版占位符：$model.Department (循环中:$item.Department)</span>
                        </div>
                    </div>
                </div>
                <div id="tab2" class="tab-pane">
                    <div class="control-group">
                        <label class="control-label">
                            内容:</label>
                        <div class="controls">
                            @Html.TextAreaFor(i => i.Contents, new { @class = "xheditor {html5Upload:false,upMultiple:1,upImgUrl:'" + Html.Raw(Url.Action("UpImg", "home")) + "'} textarea_editor span10", rows = "20", style = "height:350px;" })
                            <span class="help-block">请输入文章内容  模版占位符：$model.Contents (循环中:$item.Contents)</span>
                        </div>
                    </div>
                    <div class="control-group" style="display:none">
                        <label class="control-label">
                            英文版内容:</label>
                        <div class="controls">
                            @Html.TextAreaFor(i => i.MobileContents, new { @class = "xheditor {html5Upload:false,upMultiple:1,upImgUrl:'" + Html.Raw(Url.Action("UpImg", "home")) + "'} textarea_editor span10", rows = "20", style = "height:350px;" })
                            <span class="help-block">请输入在英文版显示的文章内容  模版占位符：$model.MobileContents (循环中:$item.MobileContents)</span>
                        </div>
                    </div>
                </div>
                <div class="form-actions">
                    <button id="Save" type="submit" class="btn btn-success" onclick="return checkfrom()"
                        style="width: 100px">
                        @Html.Raw(string.IsNullOrWhiteSpace(Request.QueryString["id"]) ? "添 加" : "编 辑")
                    </button>
                    <a href="@Url.Action("List", "Article")" class="btn btn-danger" style="width: 100px">
                        返 回</a>
                </div>
            </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript" src="@Url.Content("~/Content/xheditor/xheditor-1.1.14-zh-cn.min.js")"></script>
